package pl.softech.oldchart;

import java.awt.geom.Point2D;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import pl.softech.oldchart.AbstractGraph2DModel;

public class SimpleData1 extends AbstractGraph2DModel {

	private List<Point2D> list = new LinkedList<Point2D>();
	private Map<Double, String> xAxisLabels = new HashMap<Double, String>();
	private Map<Double, String> yAxisLabels = new HashMap<Double, String>();
	
	public SimpleData1() {
		double a = 1;
		double b = 1;
		double y;
		for(double x = -20; x < 20; x+=1) {
			y = a * x + b;
			list.add(new Point2D.Double(x,y));
		}
		
		initLabels();
	}
	
	private void initLabels() {
		for(double x = getMinX(); x < getMaxX(); x+=4) {
			xAxisLabels.put(x, "" + x);
		}
		
		for(double y = getMinY(); y < getMaxY(); y+=4) {
			yAxisLabels.put(y, "" + y);
		}
	}
	
	
	@Override
	public Collection<Point2D> getPoints() { return list; }

	@Override
	public Map<Double, String> getXAxisLabels() {
		
		return xAxisLabels;
	}

	@Override
	public Map<Double, String> getYAxisLabels() {
		
		return yAxisLabels;
	}

}
